package apis

import (
	"gitee.com/byx_darwin/ncloud-go/core"
	"gitee.com/byx_darwin/ncloud-go/core/net/consts"
	"strconv"
)

type QueryLineListConditions struct {
	Page int `json:"page"`
	Size int `json:"size"`
}
type QueryLineListRequest struct {
	core.NCloudRequest
	QueryLineListConditions
}

func NewQueryLineListRequest() *QueryLineListRequest {
	return &QueryLineListRequest{
		NCloudRequest: core.NCloudRequest{
			Path:   "/static/line",
			Method: consts.MethodGet,
		},
		QueryLineListConditions: QueryLineListConditions{
			Page: 1,
			Size: 5,
		},
	}
}

func NewQueryLineListRequestWithParams(page, size int) *QueryLineListRequest {
	return &QueryLineListRequest{
		NCloudRequest: core.NCloudRequest{
			Path:   "/static/line",
			Method: consts.MethodGet,
		},
		QueryLineListConditions: QueryLineListConditions{
			Page: page,
			Size: size,
		},
	}
}

func (r *QueryLineListRequest) SetPage(page int) {
	r.Page = page
}
func (r *QueryLineListRequest) SetSize(size int) {
	r.Size = size
}

func (r *QueryLineListRequest) GetPath() string {
	path := r.Path
	path += "?page=" + strconv.Itoa(r.Page) + "&size=" + strconv.Itoa(r.Size)
	return path
}

type LineListData struct {
	Total int        `json:"total"`
	Page  int        `json:"page"`
	Size  int        `json:"size"`
	List  []LineInfo `json:"list"`
}

type LineListResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data LineListData
}
